﻿

Imports System.Object
Imports VSModel
Imports Cls_Common
Imports System.IO
Imports System.Data
Partial Class FrontEnd_Control_Home_HotStore
    Inherits System.Web.UI.UserControl

#Region "Sub and function"
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            LoadData()
        End If
    End Sub
    Private Sub LoadData()
        Using Data As New VSEntities
            Dim p = (From q In Data.Stores Where q.StatusId = 3 And q.PublishedDate <= Now() And (q.eEffectiveDate >= Now() Or q.eEffectiveDate Is Nothing) Order By q.PublishedDate Descending Select q.Title, q.QueryString, q.StoreId, q.ImgLogo, q.Description).Take(10).ToList
            rptShow.DataSource = p
            rptShow.DataBind()
            '  hplMore.NavigateUrl = MainDomain & "rao-vat.html" '"{QueryString}-{Id}/trang-chu.html
        End Using
    End Sub
#End Region
#Region "Event for control"
    Protected Sub rptShow_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptShow.ItemDataBound
        Dim row = CType(e.Item.DataItem, Object)
        Dim img As Image = CType(e.Item.FindControl("img"), Image)
        Dim hplTitle As HyperLink = CType(e.Item.FindControl("hplTitle"), HyperLink)
        Dim hplImg As HyperLink = CType(e.Item.FindControl("hplImg"), HyperLink)
        Dim ltrDes As Literal = CType(e.Item.FindControl("ltrDes"), Literal)


        img.ImageUrl = CookedImageURL("80-80", row.ImgLogo)
        hplTitle.Text = row.Title
        hplImg.NavigateUrl = MainDomain & "salon-oto/" & row.QueryString & "-" & row.StoreId.ToString & ".html"
        hplTitle.NavigateUrl = MainDomain & "salon-oto/" & row.QueryString & "-" & row.StoreId.ToString & ".html"

        ltrDes.Text = row.Description
    End Sub
#End Region
End Class
